#include<stdio.h>
#include<math.h>
int is (int number)
{
	int i;
	int sum=0;
	int temp;
	temp=number;
	while(number)
	{
		sum=sum+pow(number%10,3);
		number=number/10;
	}
	if(temp==sum)
	{
		return 1;
	}
	else
	{
		return 0;
	}	
}
int main ()
{
	int m,n;
//	printf("%d",is(153));
	while(scanf("%d %d",&m,&n)!=EOF)
	{
		int j;
		int temp2;
		for(j=n;j>=m;j--)
		{
			if(is(j)==1)
			{
				temp2=j;
				break;
			}
		}
		for(j=m;j<=n;j++)
		{
			if(is(j)==1)
			{
				if(j!=temp2)
				{
					printf("%d\40",j);
				}
				else
				{
					printf("%d\n",j);
				}
			}
		}
	}
	return 0;
}
